package com.lucas.controller;

import com.lucas.service.UserService;
import com.netflix.discovery.converters.Auto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @program: spring_cloud_lagou_homework
 * @author: lucasLu
 **/
@RestController
@RequestMapping("/codeTest")
public class TestController {

    @Autowired
    private UserService userService;

    @Value("${datasource.driver-class}")
    private String str;

    @RequestMapping("/hello")
    @ResponseBody
    public String doTest(){
        return "hello code world"+str;
    }


    @RequestMapping("/register/{email}/{password}/{code}")
    @ResponseBody
    public Map<String,Object> userRegister(@PathVariable String email, @PathVariable  String password,@PathVariable String code){
        Map<String, Object> register = userService.register(email, password, code);
        String  data = (String) register.get("data");
        System.out.println("获取信息："+data);
        return register;
    }


}
